package com.converse.diamondreader.customized;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.Nullable;

/**
 * Author: Administrator
 * Date: 2021/12/19
 * Project: DiamondReader
 * Description:
 */
public class TrackBoxLayerView extends View {

    private List<RecognizeTextView> mChildViews=new ArrayList<>();

    public TrackBoxLayerView(Context context) {
        this(context, null);
    }

    public TrackBoxLayerView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TrackBoxLayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setBackgroundColor(Color.TRANSPARENT);
    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        for (RecognizeTextView view : mChildViews) {
            view.draw(canvas);
        }
    }


   public void clear(){
        mChildViews.clear();
   }

    public void addRecognizeView(RecognizeTextView recognizeTextView) {
        mChildViews.add(recognizeTextView);
    }
}
